package top.byfree.jbyan.saber.controller

import cn.dev33.satoken.annotation.SaCheckRole
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import top.byfree.jbyan.saber.common.R
import top.byfree.jbyan.saber.common.createCode
import top.byfree.jbyan.saber.common.ok
import top.byfree.jbyan.saber.service.EmailService

/**
 * 测试连通控制器
 *
 * @author jbyan
 * @since 21/3/2024
 */
@RestController
@RequestMapping("ping")
class PingController(
    @Autowired private val emailService: EmailService
) {

    @GetMapping
    @SaCheckRole("temp.test")
    fun ping() : R<Unit> {
        emailService.sendEmail("yanjinbiaohere@163.com", createCode(4))
        return ok()
    }



}